package model.components.nodes.node.sdn;

import model.components.nodes.node.Node;
import model.components.nodes.node.virtual.VirtualNode;

public class SdnSwitch extends SdnNode
{
	public SdnSwitch( String networkName, int number, String os, int cpu, int ram, int availableVirtualNodesNumber )
	{
		super( networkName, SdnSwitch.class.getSimpleName(), number, Node.SWITCH_TYPE, os, cpu, ram, availableVirtualNodesNumber, Node.GREY_SWITCH, Node.GREEN_SWITCH, Node.YELLOW_SWITCH, Node.RED_SWITCH );
	}
	
	@Override
	public SdnSwitch getCopy()
	{
		SdnSwitch sdnSwitch = new SdnSwitch( this.getNetworkName(), this.getNumber(), this.getOS(), this.getCPU(), this.getRAM(), this.getAvailableVirtualNodesNumber() );
		sdnSwitch.setInitialNumber( this.getInitialNumber() );
		sdnSwitch.setNamePrefix( this.getNamePrefix() );
		sdnSwitch.setType( this.getType() );
		sdnSwitch.setAvailableCPU( this.getAvailableCPU() );
		sdnSwitch.setAvailableRAM( this.getAvailableRAM() );
		sdnSwitch.setMaxVirtualNodesNumber( this.getMaxVirtualNodesNumber() );
		sdnSwitch.setTimeStamp( this.getTimeStamp() );
		sdnSwitch.setSelected( this.isSelected() );
		
		for( VirtualNode virtualNode: this.getVirtualNodes() )
			sdnSwitch.add( virtualNode.getCopy() );
		
		return sdnSwitch;
	}
	
	public SdnSwitch getSoftCopy()
	{
		SdnSwitch sdnSwitch = new SdnSwitch( this.getNetworkName(), this.getNumber(), this.getOS(), this.getCPU(), this.getRAM(), this.getAvailableVirtualNodesNumber() );
		sdnSwitch.setInitialNumber( this.getInitialNumber() );
		sdnSwitch.setNamePrefix( this.getNamePrefix() );
		sdnSwitch.setType( this.getType() );
		sdnSwitch.setAvailableCPU( this.getAvailableCPU() );
		sdnSwitch.setAvailableRAM( this.getAvailableRAM() );
		sdnSwitch.setMaxVirtualNodesNumber( this.getMaxVirtualNodesNumber() );
		sdnSwitch.setTimeStamp( this.getTimeStamp() );
		sdnSwitch.setSelected( this.isSelected() );
		
		return sdnSwitch;
	}

}
